//
//  ViewController.m
//  02-UIViewController
//
//  Created by dllo on 16/7/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "PresentViewController.h"
@interface ViewController ()

@end

@implementation ViewController
// 初始化方法
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // 不要再这个方法中加载视图
        // 在这个方法中初始化一些数据相关的内容
    }
    return self;
}
// loadView 加载视图
// UINavigationController
// UITableViewController 在loadView中重写赋值
- (void)loadView
{
    [super loadView];
    NSLog(@"loadView");
}
// 视图已经加载
// 所有自定义视图创建
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    self.view = nil;
    self.view.backgroundColor = [UIColor whiteColor];

}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    PresentViewController *presentVC = [[PresentViewController alloc] init];
    // UIModalTransitionStylePartialCurl 翻页
    // UIModalTransitionStyleCrossDissolve 渐变
    // UIModalTransitionStyleFlipHorizontal 旋转
    presentVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentViewController:presentVC animated:YES completion:^{
        
    }];
    
}
// 注意: init loadView viewDidLoad 只执行一次
// 下面方法会执行多次的
// 试图将要出现时
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}
// 已经出现
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}
// 将要消失
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}
// 已经消失
- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

// 接受到内存警告时执行的方法
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.
    // 释放部分内存资源
    // 把未显示在屏幕上的资源置空

}

@end
